﻿/// <reference path="../Ext4.0/ext-all.js" />
    var EditInfoForm = Ext.create('Ext.form.Panel', {
        width: 300,
        height: 310,
        plain: true,
        id: 'frmEdit',
        frame: true,
        labelWidth: 45,
        defaultType: "textfield",
        baseCls: "x-plain",
        layout: 'anchor',
        defaults: { anchor: "95%", msgTarget: "side" },
        url: "HotelRegMag.aspx?action=Reg",
        defaultType: 'textfield',
        items: [{
            name: 'ID',
            hidden:true
        }, {
            fieldLabel: '姓名',
            name: 'Name'
        }, {
            fieldLabel: '所在学校',
            name: 'School',
            allowBlank: false
        }, {
            fieldLabel: '已付款',
            name: 'PayMoney',
            allowBlank: true
        }, {
            fieldLabel: '考点',
            name: 'ExamPlace',
            allowBlank: true
        }, {
            fieldLabel: '宾馆',
            name: 'Hotel',
            allowBlank: true
        }, {
            fieldLabel: '房间号',
            name: 'Room',
            allowBlank: true
        }, {
            fieldLabel: '住房花费',
            name: 'HotelExpense',
            allowBlank: true
        }, {
            fieldLabel: '退款',
            name: 'MoneyBack',
            allowBlank: true
        }],
        buttonAlign: "center",
        bodyStyle: "padding:0 0 0 0",
        buttons: [{
            text: '保存',
            formBind: true, 
            disabled: true,
            handler: function () {
                var form = this.up('form').getForm();
                if (form.isValid()) {
                    form.submit({
                        success: function (form, action) {
                            Ext.Msg.alert("恭喜", "修改成功");
                            StorePage.load();
                            ParentID = "";
                            ParentName = "";
                            EditWin.hide();
                        },
                        failure: function (form, action) {
                            Ext.Msg.alert('Failed', action.result.msg);
                        }
                    });
                }
            }
        }]
    });

    var EditWin = Ext.create('Ext.window.Window', {
        title: '修改',
        width: 320,
        height: 350,
        layout: 'fit',
        labelWidth: 100,
        closeAction: 'hide',
        resizable: false,
        modal: 'true',
        iconCls: "editicon",
        items: EditInfoForm,
        listeners: {
            "show": function () {
                Ext.getCmp('frmEdit').getForm().loadRecord(row[0]);
            }
        }
    });
  


